﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Twin
{
    class KConst
    {
        /*
        public const int LEN_HEAD8 = 8;
        public const byte VER_MARK = (byte)'J';    //KUI-S协议
    
        //KUI-S协议: 
        public const int OFFSET_VER         = 0;    //Length : 1
        public const int OFFSET_LEN         = 1;    //Length : 1
        public const int OFFSET_ID          = 2;    //Length : 1
        public const int OFFSET_OP          = 3;    //Length : 1
        public const int OFFSET_PROPERTY    = 4;    //Length : 1
        public const int OFFSET_INDEX       = 5;    //Length : 1
        public const int OFFSET_RESERVED    = 6;    //Length : 1
        public const int OFFSET_CRC          = 7;   //Length : 1
    */
        //=============================================================
        public const int BODY0  = 0;   
        public const int OFFSET_BODY_LEN    = 32;   //Length : 2
        public const int OFFSET_BODY_START  = 34;   

        public const int LEN_PSW = 6;
    
        //netty
        public const int MAX_FRAME_LENGTH = 2048;        //1024;
    
        //包分割符
        public const String SEPERATOR       = "$_";
    
        //心跳间隔(s)
        public const int HEART_BEAT_SECONDS = 60;

        //MsgIn通道寿命（s）
        public const int MSG_IN_CHANNEL_LIFE = 60;
    
        //Line status
        public const int LINE_STATUS_UNCONNECT   = 1;
        public const int LINE_STATUS_CONNECT     = 2;
        public const int LINE_STATUS_SIGN        = 3;    
        public const int LINE_STATUS_HEARTBEAT   = 4;    
        public const int LINE_STATUS_CLOSE   = 4;    

        //Line-status expected
        public const bool LINE_EXPECT_ON = true;    
        public const bool LINE_EXPECT_OFF = false;    
    
         //print to...
        public const int SCREEN_NULL = 0;        //不显示    
        public const int SCREEN_SYS = 1;    
        public const int SCREEN_WIN = 2;  
        public const int SCREEN_STREAM = 3;  
    
        //Property16
        public class PP{
            public const byte bitINST_DIR    = 0;
            public const byte bitWITH_BIN    = 1;
            public const byte bitWITH_STR    = 2;
            public const byte bitCAT         = 3;
            public const byte bitFILE_SYS    = 4;       //是否系统文件。系统文件必须立即合并处理
            public const byte bitWITH_DEST   = 6;
            //
            public const byte bitPRIORITY    = 13;      //优先级
            public const byte bitRESULT      = 15;        //事务原子处理结果
        }
    
    
        public const int WIDTH_CRC8          = 1;
        public const int WIDTH_CRC16         = 2;
    
        //FILE_SYS 常用缩略名称
        public const String FILE_SETTING     = "SETTINGS";
        public const String FILE_TERMS       = "TERMS";
        public const String FILE_CLIENTS     = "CLIENTS";
        public const String FILE_R_T2C       = "R_T2C";
    
        public const String FILE_STATUS      = "STATUS";

    
    
        public const int OUT_LIMIT_LENGTH = 1024 * 256;  //Textout, winTxt长度限制
    
        //分发关系字符串长度，e.g:“1025:1002,1004,1367,2654,7764,3567,9523,10026,724,8735,1024”
        public const int LIMIT_RELATIONS_LENGTH = 100;   //500;
    
        //
        public const int LIMIT_PUSH_LIST = 100000;   //500;
    
    
    
        public class CAT{
            public const int FNAME        = 0;
            public const int ID           = 1;
            public const int INDEX        = 2;
            public const int SIZE         = 3;
            public const int SEG          = 4; 
            public const int CRC          = 5; 
        }
    }
}
